package br.com.controller;

import java.sql.Connection;
import java.util.List;

import br.com.bean.DisciplinaBean;
import br.com.bean.DisciplinaTurmaBean;
import br.com.bean.TurmaBean;
import br.com.dao.DisciplinaDao;

public class DisciplinaController {

	public static void inserir(Connection conn, String disciplina) throws Exception{

		DisciplinaBean bean = new DisciplinaBean();
		bean.setDisciplina(disciplina);
		

		DisciplinaDao dao = new DisciplinaDao();
		dao.inserir(conn,bean);
	}

	public static void excluir(Connection conn, int id) throws Exception{

		DisciplinaBean bim = new DisciplinaBean();
		bim.setId(id);

		DisciplinaDao dao = new DisciplinaDao();
		dao.excluir(conn,bim);
	}

	public static void update(Connection conn, String disciplina, int id) throws Exception{

		DisciplinaBean bim = new DisciplinaBean();
		bim.setId(id);
		bim.setDisciplina(disciplina);


		DisciplinaDao dao = new DisciplinaDao();
		dao.alterar(conn,bim);
	}
	//controller do combo dinamico de turma e disciplina
	public static List<DisciplinaTurmaBean> ListDisc(Connection conn, int turma) throws Exception{

		TurmaBean bean = new TurmaBean();
		DisciplinaDao dao = new DisciplinaDao();
		bean.setId(turma);
		
		List<DisciplinaTurmaBean> disciplinaList = dao.getListaDisc(conn, bean);

		return disciplinaList;

	}
	
	//controller do combo simples
		public static List<DisciplinaBean> ListDisc(Connection conn) throws Exception{

			
			DisciplinaDao dao = new DisciplinaDao();
			List<DisciplinaBean> disciplinaList = dao.getListaDisc(conn);

			return disciplinaList;

		}


}